#!/usr/bin/env bash

echo $'\n'"=======  executing rollbackRemote.sh =============== "$'\n'

bakApp=$1
if [ -z "$bakApp" ]
then
    echo "need param [bakApp]"
    exit
fi

app=`echo bakApp |cut -d '@' -f 1`
ip=`echo bakApp |cut -d '@' -f 2`


cat jenkins/config > /tmp/rollback$bakApp.sh
echo "bakApp=$1" >> /tmp/rollback$bakApp.sh
cat rollbackTmpFile.sh >> /tmp/rollback$bakApp.sh

ssh $server_username@$ip /usr/bin/bash < /tmp/rollback$bakApp.sh
